<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}"/>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
    <style>
        /* 背景和整体风格 */
        body {
            background: linear-gradient(to bottom right, #ffe4e6, #ffc2c4);
            font-family: 'Poppins', sans-serif;
            margin: 0;
            padding: 0;
        }

        /* 标题样式 */
        h3 {
            color: #ff6b81;
            font-weight: 600;
            font-size: 28px; /* 调整标题字体大小 */
            text-align: center;
            margin-bottom: 25px;
        }

        /* 表单容器 */
        .register-container {
            width: 420px;
            padding: 30px 25px;
            margin: 80px auto;
            background-color: #fffafa;
            border-radius: 15px;
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
        }

        /* 表单标签样式 */
        .form-group label {
            color: #ff6b81;
            font-size: 15px;
            font-weight: 500;
        }

        /* 表单输入框 */
        .form-control {
            border: 1px solid #ffc2c4;
            border-radius: 8px;
            font-size: 14px;
            padding: 10px;
        }

        /* 输入框聚焦样式 */
        .form-control:focus {
            box-shadow: 0 0 8px #ff8fa3;
            border-color: #ff8fa3;
        }

        /* 按钮样式 */
        button {
            background-color: #ff6b81;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            padding: 12px 25px;
            transition: all 0.3s ease;
        }

        button:hover {
            background-color: #ff8fa3;
            box-shadow: 0 4px 10px rgba(255, 107, 129, 0.3);
        }

        .btn-default {
            width: 120px;
            margin-top: 10px;
        }

        /* 提示信息 */
        ul li {
            color: #ff6b81;
            font-size: 14px;
            line-height: 1.6;
        }

        /* 居中按钮组 */
        .text-center {
            text-align: center;
        }

        /* 移动设备优化 */
        @media (max-width: 480px) {
            .register-container {
                width: 90%;
                padding: 20px;
            }
            h3 {
                font-size: 24px;
            }
        }
    </style>
    <script src="../../static/js/jquery-3.7.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            var oInput = $("#loginname");
            oInput.focus();
        });

        function check() {
            var loginname = $('#loginname').val();
            if (loginname === "") {
                alert("登录名必填");
                $("#loginname").focus();
                return;
            }
            var loginpass = $('#loginpass').val();
            if (loginpass === "") {
                alert("密码必填");
                $("#loginpass").focus();
                return;
            }
        }
    </script>
</head>
<body>
    <div class="register-container">
        {% if messages %}
            <div>
                <ul>
                    {% for m in messages %}
                    <li>{{ m }}</li>
                    {% endfor %}
                </ul>
            </div>
        {% endif %}
        <h3>注册</h3>
        <form id="lg" method="post" class="form-horizontal">
            {% csrf_token %}
            <div class="form-group">
                <label for="loginname" class="control-label">登录名</label>
                <input type="text" class="form-control" id="loginname" name="loginname" placeholder="请输入登录名"/>
            </div>
            <div class="form-group">
                <label for="loginpass" class="control-label">密码</label>
                <input type="password" name="loginpass" id="loginpass" class="form-control" placeholder="请输入密码"/>
            </div>
            <div class="form-group text-center">
                <button class="btn btn-default" type="button" onclick="check()">注册</button>
            </div>
        </form>
    </div>
</body>
</html>
